package Month11.Day10;

import java.lang.reflect.Array;

public class T4 {
    public static void main(String[] args) {
        StringBuilder s1=new StringBuilder();
        String a = "a";
        Long start=System.currentTimeMillis();
       for (int i=0;i<100000;i++){

          s1.append(a);
       }
       System.out.println(s1);
       Long end=System.currentTimeMillis();
        System.out.println("StringBuilder拼接耗时："+(end-start)+"毫秒");

        StringBuffer s2=new StringBuffer();
        String b = "a";
        Long start1=System.currentTimeMillis();
        for (int i=0;i<100000;i++){

            s1.append(b);
        }
        System.out.println(s1);
        Long end1=System.currentTimeMillis();
        System.out.println("StringBuffer拼接耗时："+(end1-start1)+"毫秒");


    }
}
